[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
V_FILLARR()
Fill a Clipper S87 array with contents stored to a DBV file
-------------------------------------------------------------------------------
Syntax
V_FILLARR( <aTarget>,
<cPointer>,
[<nArea> | <cAlias>] )
Arguments
<aTarget> is the Clipper S87 array to be filled.
<cPointer> is a six byte pointer-field that points to the DBV
containing a Clipper type array.
<cAlias> or <nArea> is a DBV file alias or area specified when the
file was V_USE()d. If omitted, the pointer will point into the
currently selected DBV area.
Returns
None. However, <aTarget> is modified.
Description
V_FILLARR() is used to fill an array when using the Clipper S'87
compiler (See V_RETRIEVE() for retrieving an array in an application
compiled with Clipper 5.0 ). The <aTarget> array must exist and
will be filled until <aTarget> has no remaining elements or the
array pointed to by <cPointer> has no more elements (which ever
limit is reached first).
Use the V_LEN() function to dimension the array immediately before
V_FILLARR() (see examples below).
The ability to save Clipper arrays is one of the most powerful
features of FlexFile. Essentially, it simulates Variable Length
Records as well as creating a three dimensional effect in your
data base files.
For example, picture a student master DBF file with the fields
LastName, FirstName, Addr, Major, and Minor. If you decide to
expand the file and include the sports, clubs and associations
that the student is involved in, you have two choices. You can
create a new related file (with a new index), or you can insert
several new fields in the master DBF for each category, limiting
the entries possible in any one category and wasting space on
students who do not have entries in one or more of the categories.
With FlexFile, however, you can add just one field in the master
file and save an array of any length to this field. Not only do
you eliminate a file, its index, and its relation, but also, one
function call can load arrays with the new data eliminating the
need to code "scatter" and "gather" routines.
Notes
. It is not necessary to use this routine to retrieve a FlexFile
type array.
Examples
&& S'87 compiler only. See V_RETRIEVE() for Clipper 5.0 type arrays
&& Open a DBF and a related DBV file
USE dbf_file
V_USE( "dbv_file" )
DECLARE aNames[3]
aNames[1] = "Tania"
aNames[2] = "Mary"
aNames[3] = "Allison"
&& Store the array to the DBV file and its pointer to the DBF
REPLACE vlf WITH V_REPLACE( aNames, vlf )
&& Declare the new array to the proper size.
DECLARE aNewNames[ V_LEN( vlf ) ]
&& Fill the array with the data.
V_FILLARR( aNewNames, vlf )
&& Show that it worked
? aNewNames[1] && Result: Tania
See Also:
V_REPLACE()
V_LEN()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson